<template>
  <el-container>
    <el-header  style="padding-top: 0px;padding-bottom: 0px;height: 40px;background-color: rgb(249, 249, 249);border-bottom: 1px solid #e6e6e6;">
			<div class="left-panel">
					<label style="font-size: 14px;margin-left: 5px;">{{title}}</label>
			</div>
			<div class="right-panel">
				<fsButton ref="button" plain size="small" :buttons="buttons" @clickHandler="buttonHandler"></fsButton>
			</div>
		</el-header>
    <el-main style="padding: 0px;margin-top: 5px;background-color: #fff;padding-top: 20px;">
      <el-form :model="form"  ref="dialogForm" label-width="130px" label-currency="left">
                <el-form-item label="公告标题" prop="noticeName" style="width: 40%;">
                  {{form.noticeName}}
                </el-form-item>
                <!--el-form-item label="创建时间"  style="width: 40%;">
                  <ex-label format code="DATETIME" :value="form.createTime"/>
                </el-form-item>
                <el-form-item label="创建人"   style="width: 40%;">
                  <ex-label code="SysUser" :value="form.createUser"/>
                </el-form-item>
                <el-form-item label="是否可用"  style="width: 40%;">
                  <ex-label code="IS_ENABLED" :value="form.isEnabled"/>
                </el-form-item-->
                <el-form-item label="公告内容">
                  <div v-html="form.noticeContent"></div>
                </el-form-item>
              </el-form>




  </el-main>
</el-container>
</template>

<script>
import ExRelTable from "@/components/exRelTable/index.vue";
import ExLabel from "@/components/exLabel/index.vue";
import exDialog from '@/components/exDialog';
import tool from "@/utils/tool";
import router from "@/router";

export default {
  computed: {
  },
  emits: ['success'],
  components: {
	  ExLabel,
    ExRelTable,
    exDialog
  },
  props: {
  },
  data() {
    return {
      activeName: 'base',
      visible: false,
      form: {},
      title:"查看公告",
      isCreate:"0"
    }
  },
  created() {
		//如果是通过跳转过来的，标签的名称设置为跳转后的标题
    let route = router.currentRoute.value;
		if (route.meta) {
			this.title = route.meta.title;
		}
		console.log(this.$route.params.key);
		let routeParams = this.$store.state.routeParams[this.$route.params.key];
    console.log(11111);
    console.log(routeParams);
		if (routeParams) {
			if (routeParams.title) {
        this.title=routeParams.title;
			}
			if (routeParams.fixedParams) {
				if (routeParams.fixedParams.id) {
          console.log(routeParams.fixedParams.id);
		
          this.getDataByQueryDto(routeParams.fixedParams.id);
				}
				if (routeParams.fixedParams.id) {
					
				}else{
					this.isCreate = '0';
				}
			}

		}
	},
  methods: {
    //显示
    open(entity) {
      this.form = Object.assign({}, entity);
      this.visible = true;
      this.activeName = "base";
    },
    async getDataByQueryDto(id) {	
      console.log(id);
			//let rsp = await this.$API.system.notice.findById.post({id: this.form.id});
      let rsp = await this.$API.system.notice.findById.post({id: id});
			if (rsp.code === 2000 && rsp.data) {
        this.form=rsp.data;
        console.log(this.form);
        /*form: {
        id: "",
        noticeName: "",
        noticeContent: "",
        pathCode: "",
        attachFile:"",
        attachFileJSON:"",
      },
 */
			}
		},
  }
}
</script>

<style scoped>
h2 {
  font-size: 17px;
  color: #3c4a54;
  padding: 0 0 30px 0;
}

[data-theme="dark"] h2 {
  color: #fff;
}

</style>
